package org.someone.common;

public class StringUtils {
	public static String replaceLast(String og, String oldstr, String newstr){
		if(og == null){
			return null;
		}
		if(oldstr==null || newstr==null || "".equals(oldstr)){
			return og;
		}
		int intbeginIndex = og.lastIndexOf(oldstr);
		if(intbeginIndex == -1){
			return og;
		}
		int intoldlength = oldstr.length();
		int intEndIndex = intbeginIndex + intoldlength;
		String strpre = og.substring(0, intbeginIndex);
		String strsuf = og.substring(intEndIndex);
		return strpre + newstr + strsuf;
	}
}
